from apps.goods.models import GoodsCategory


def get_breadcrumb(category_id):

    cat3=GoodsCategory.objects.get(id=category_id)

    cat2=cat3.parent

    cat1=cat2.parent

    breadcrumb={
        'cat1':{
            'id':cat1.id,
            'name':cat1.name,
            'url':cat1.goodschannel_set.all()[0].url
        },
        'cat2':cat2,
        'cat3':cat3
    }

    return breadcrumb